package com.pat.jrgwt.client;

import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;

public abstract class BaseMonthTableView extends BaseTableView
{

    @Override
    public void drawTable()
    {
        super.drawTable();
        
        final YearSelector ys = new YearSelector();
        ys.addYearChangeHandler(new ChangeHandler()
        {
            
            @Override
            public void onChange(ChangeEvent event)
            {
                onYearChanged(ys.getSelectedYear());
            }

        });
        m_table.setWidget(0, 0, ys);
    }
    
    @Override
    protected void setRowLabels()
    {
        m_arRowLabels = new String[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec" };
    }
    
    /**
     * Should implement behavior on year changes
     * @param year
     */
    public abstract void onYearChanged(final int year);
    
}
